<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Links extends Model
{
    protected $table = 'links';
    public $timestamps = false;
    protected $guarded = [];
    
    // 显示友情链接
    public static function show($limit=20)
    {
        $links = self::where('link_status', 1)
                ->orderBy('link_sort', 'asc')
                ->paginate($limit);
        return $links;
    }
    
    // 底部友情链接
    public static function bottomLinks()
    {
        $links = self::where('link_status', 1)
                ->orderBy('link_sort', 'asc')
                ->limit(10)
                ->get();
        return $links;
    }
    
    // 后台显示友情链接列表
    public static function getLinksList()
    {
        $links = self::where('link_status', '<>', -1)
                ->orderBy('link_sort', 'asc')
                ->paginate(15);
        return $links;
    }
}
